package com.example.tool;
import java.util.List;
import com.example.netity.Tminfo;
import com.example.view.R;
import com.example.view.SecondActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class MyAdapter extends BaseAdapter {
	private SecondActivity mContext = null;
	private List<Tminfo> mData;
	private ViewHolder holder;

	public MyAdapter(SecondActivity lushuUtils, List<Tminfo> data) {
		mContext = lushuUtils;
		mData = data;
	}

	@Override
	public int getCount() {
		return mData.size();
	}
	public void setData(List<Tminfo> mData) {
		this.mData = mData;
	}
	

	@Override
	public Object getItem(int position) {
		return null;
	}	
	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.item_gv2, parent, false);
			holder = new ViewHolder();
			holder.id = (TextView) convertView.findViewById(R.id.gv2_id);
			holder.shijian = (TextView) convertView.findViewById(R.id.gv2_time);
			holder.tm = (TextView) convertView.findViewById(R.id.gv2_tm);	

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}					    
			holder.id.setText(mData.get(position).getId());
			holder.shijian.setText(mData.get(position).getShijian());
			holder.tm.setText(mData.get(position).getTm());			
		return convertView;

	}

	static final class ViewHolder {
		TextView id, shijian, tm;
	}

}
